const path=require("path");

console.log(path.join(__dirname,'./a/b'))
// C:\Users\Administrator\Desktop\daily\0810\demo\a\b
// __dirname __dirname


let str='/a/b/c/index.html'
let img='/a/b/c/index.png'
// basename 取出 文件的类型
console.log(path.basename(str))
console.log(path.basename(img))
console.log(path.basename(img))
// index.html

// extname 后缀名 
console.log(path.extname(str))
console.log(path.extname(img))
console.log(path.extname(img))

//  path.resolve() 获取的是绝对路径
console.log(path.resolve(str))
console.log(path.resolve(img))
console.log(path.resolve(img))

let url = path.join(path.resolve(),'./a/b/c')
let url1 = path.join(path.resolve(),'../../')
console.log(url)
console.log(url1)
/* 
C:\Users\Administrator\Desktop\daily\0810\demo\a\b\c
C:\Users\Administrator\Desktop\daily\
 */
